-module(comm).

-export([start/0, snd/2, rcv/0]).

-define(N1, n1@localhost).
-define(N2, n2@localhost).

start() ->
    Pid = spawn(?N1, ?MODULE, rcv, []),
    spawn(?N2, ?MODULE, snd, [Pid, 1]).

rcv() ->
    receive
        N -> io:format("got ~p~n", [N]), rcv()
    end.

snd(Pid, N) ->
    Pid ! N,
    timer:sleep(1000),
    snd(Pid, N+1).
